<link href="__PUBLIC__/themes/blue/layout.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/js/jquery.js"></script>
<script type="text/javascript">
function copyToClipboard() {   
     var txt = $('#id_list').val();
	 
     if(window.clipboardData) {   
             window.clipboardData.clearData();   
             window.clipboardData.setData("Text", txt);   
     } else if(navigator.userAgent.indexOf("Opera") != -1) {   
          window.location = txt;   
     } else if (window.netscape) {   
          try {   
               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");   
          } catch (e) {   
               alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");   
          }   
          var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);   
          if (!clip)   
               return;   
          var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);   
          if (!trans)   
               return;   
          trans.addDataFlavor('text/unicode');   
          var str = new Object();   
          var len = new Object();   
          var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);   
          var copytext = txt;   
          str.data = copytext;   
          trans.setTransferData("text/unicode",str,copytext.length*2);   
          var clipid = Components.interfaces.nsIClipboard;   
          if (!clip)   
               return false;   
          clip.setData(trans,null,clipid.kGlobalClipboard);   
          alert("复制成功！")   
     }   
} 

var idArr = [];
var appData = "{:$_GET['appData']}";
if(appData==''){
	appData='ask';
}

function dealId(id){
	var id_list = '';
	var isIn = jQuery.inArray(id, idArr); 
	if(isIn != -1){ //删除
		idArr.splice(isIn, 1);
	}else{  //增加
	    var i = idArr.length;
		idArr[i] = id;	
	}
	
	id_list = idArr.join(',');
	$("#id_list").val(id_list);	

	$('#id_count').html(idArr.length);
}

function updateList(){
	switch(appData){
		case 'ask':
			var param   = "&status="+$('[name="status"][checked=true]:radio').val();
			break;
		case 'blog':
			var param = "&uid="+$("#uid").val();
			break;			
		case 'bbs':
			var dist  = $('[id="dist"][checked=true]:checkbox').val();
			var top   = $('[id="top"][checked=true]:checkbox').val();
			var param   = "&dist="+dist+"&top="+top;
			break;			
		case 'wiki':
			var param   = "&focus_type="+$('[name="focus_type"][checked=true]:radio').val();
			break;
	}
	
	var title   = $("#title").val();
	param += "&appData="+appData+"&title="+title;

    $('#iframelist').attr('src',"{:U('portal/Data/articleList')}"+param);
}

$(function(){
	$("[id*='search_']").each(function(i,n){
		$(this).css('display', 'none');
	});
	
	$("#search_"+appData).css('display', '');
	$("#nav_"+appData).attr('class', 'on');
});
</script>
<div class="contents mt10">
    <div class="list_box">
        <ul class="tab">
            <li id='nav_ask'>
                <span><a href="{:U('portal/Data/index',array('appData'=>'ask'))}">知道</a></span>
            </li>
            <li id='nav_blog'>
                <span><a href="{:U('portal/Data/index',array('appData'=>'blog'))}">博客</a></span>
            </li>
            <li id='nav_bbs'>
                <span><a href="{:U('portal/Data/index',array('appData'=>'bbs'))}">论坛</a></span>
            </li>
            <li id='nav_wiki'>
                <span><a href="{:U('portal/Data/index',array('appData'=>'wiki'))}">百科</a></span>
            </li>            
        </ul>
    </div>
    <div class="C"></div>
    <div class="mt20">
        <div class="L" style="width:60%; overflow:hidden;">
            <iframe id="iframelist" src="{:U('portal/Data/articleList',array('appData'=>$_GET[appData]))}" width="100%" marginwidth="0" height="700" marginheight="0" align="top" scrolling="auto" frameborder="0"></iframe>
        </div>
        <div class="L mt20">
            <table width="65%">
                <tr height="40">
                    <td align="right" width="40">标题：</td>
                    <td align="left"><input class="in_put" type="text" name="title" id="title"></td>
                </tr>
                <tr height="30" id="search_ask">
                    <td align="right" valign="top">状态：</td>
                    <td align="left" class="lh22" valign="top"><input class="in_mr5" name="status" type="radio" value="" checked>
                        全部 &nbsp;
                        <input class="in_mr5" name="status" type="radio" value="0">
                        待解决 &nbsp;
                        <input class="in_mr5" name="status" type="radio" value="1">
                        已解决 &nbsp;
                        <input class="in_mr5" name="status" type="radio" value="2">
                        已关闭 &nbsp;
                        <input class="in_mr5" name="status" type="radio" value="3">
                        已过期</td>
                </tr>
                <tr height="30" id="search_blog">
                    <td align="right">用户ID：</td>
                    <td><input class="in_put" type="text" name="uid" id="uid"></td>
                </tr>
                <tr id="search_bbs"  height="30">
                    <td align="right">状态：</td>
                    <td><input class="in_mr5" type="checkbox" id="dist" value="1">
                        精华帖
                        <input class="in_mr5" type="checkbox" id="top"  value="1">
                        置顶帖 </td>
                </tr>
                <tr id="search_wiki"  height="30">
                    <td align="right">状态：</td>
                    <td><input class="in_mr5" name="focus_type" type="radio" value="0" checked>
                        全部 &nbsp;
                        <input class="in_mr5" name="focus_type" type="radio" value="1">
                        推荐词条&nbsp;
                        <input class="in_mr5" name="focus_type" type="radio" value="2">
                        精华词条 &nbsp;
                        <input class="in_mr5" name="focus_type" type="radio" value="4">
                        待完善词条 </td>
                </tr>
                <tr height="40">
                    <td align="right">&nbsp;</td>
                    <td><input class="btn_sea" type="button" value=" 搜索 " onClick="updateList()"></td>
                </tr>
            </table>
            <table width="100%" cellpadding="0" class="mt10">
                <tr>
                    <td><label> 已选
                            <span id="id_count">0</span>
                            个ID<br />
                            <textarea class="in_put cl03 mt5" name="id_list" id="id_list" cols="50" rows="10"></textarea>
                        </label></td>
                </tr>
                <tr>
                    <td><label>
                            <input class="btn_sea" type="button" value=" 复制 " onClick="copyToClipboard()">
                        </label></td>
                </tr>
            </table>
        </div>
        <div class="C"></div>
    </div>
    <div class="C"></div>
</div>
